#include "../../client/rpc_client.hpp"

void callback(const std::string & key,const std::string & msg)
{
    LOG(INFO,"%s 主题收到推送过来的消息 %s",key.c_str(),msg.c_str());
}

int main()
{
    //实例化客户端对象
    //创建主题
    //订阅主题
    //等待->退出
    auto client = std::make_shared<rpc::client::TopicClient>("127.0.0.1", 7070);
    bool ret = client->create("hello");
    if (ret == false)
    {
        LOG(ERROR, "创建主题失败");
        return 1;
    }
    ret = client->subscribe("hello",callback);
    std::this_thread::sleep_for(std::chrono::seconds(10));
    client->shutdown();
    return 0;
}